
package view;

import controllers.HelpContentControl;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.HPos;
import javafx.geometry.Insets;
import javafx.geometry.VPos;
import javafx.scene.control.Hyperlink;
import javafx.scene.control.Label;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.paint.Color;
import javafx.scene.paint.CycleMethod;
import javafx.scene.paint.LinearGradient;
import javafx.scene.paint.Stop;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import javafx.scene.text.Text;
import javafx.stage.Stage;

/**
 *
 * @author john
 */
public class AboutDialog extends CustomizedStage{
    
    private final double wrappingWidth=400;
    
    private GridPane grid;
    private Text titleText;
    private Label versionL;
    private Text descriptionText;
    private Hyperlink documentationLink;
    
    public AboutDialog(Stage owner) {
        this(owner, 0, 0);
    }

    public AboutDialog(Stage owner, double width, double height) {
        super(owner, "Acerca de SATACrédito", width, height);
        setOnClose(HIDE);
        grid=new GridPane();
        grid.setPadding(new Insets(20));
        grid.setHgap(10);
        grid.setVgap(10);
        grid.setId("about-dialog");
        titleText=new Text("SATACrédito");
        titleText.setId("main-title");
        titleText.setFill(Color.rgb(80,80,80));
        //titleText.setFill(new LinearGradient(0, 0, 0, 1.0, true, CycleMethod.NO_CYCLE, new Stop(0, Color.rgb(80, 80, 80)), new Stop(1.0, Color.rgb(110,110,110))));
        versionL=new Label("Versión 1.0");
        descriptionText=new Text("Pretium non adipiscing quis, vestibulum sed augue."
            + "Pellentesque urna tortor, sagittis eu interdum vel, porta at orci."
            + "Integer vitae justo a erat volutpat fermentum dapibus a dui. ");
        descriptionText.setWrappingWidth(wrappingWidth);
        documentationLink=new Hyperlink("Documentación oficial");
        documentationLink.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent t) {
                HelpContentControl.openDocumentation();
            }
        });
        GridPane.setConstraints(titleText, 0, 0);
        GridPane.setConstraints(versionL, 0, 1);
        GridPane.setConstraints(descriptionText, 0, 2);
        GridPane.setConstraints(documentationLink, 0, 3, 1, 1, HPos.CENTER, VPos.CENTER);
        grid.getChildren().addAll(titleText,versionL,descriptionText,documentationLink);
        setContent(grid);
    }
    
}